#include "pkeyitem.h"
#include "pkeylist.h"
#include "NumStr.h"

#include <QDebug>

string PKeyItem::m_objname = "PKeyItem";

PKeyItem::PKeyItem() :
    PItem(EXA_TAB_NULL)
{
}

PKeyItem::PKeyItem(const PKeyItem& pk) :
    PKey(pk),
    PItem(pk)
{
}

//PKeyItem::PKeyItem(int tab_ref) :
//    PKey(),
//    PItem(tab_ref)
//{

//}

PKeyItem::PKeyItem(int tab_ref)
{
    setTabRef(tab_ref);
}

PKeyItem::PKeyItem(const string &key)
{
    setKeyStr(key);
}

void PKeyItem::reportMake( const string& objname ) const
{
    if (getReportCurrentStyle() == STYLE_VERBOSE)
    {
        addInLine("key",getKeyStr(),16);
        addInLine("descr",getDescr());
        addInLine("tab_ref",getTabRef());
        addInLine("tab_name",PKeyList::getListNameFromId(getTabRef()),0);
        moveLineInBlock();
    }
    else if (getReportCurrentStyle() == STYLE_COMPACT)
    {
        addInLine("ID",getKeyStr(),2);
        addInLine("des.",getKeyStr(),5);
        addInLine("ref",getTabRef(),2);
        addInLine("tab_name",PKeyList::getListNameFromId(getTabRef()),0);
        moveLineInBlock();
    }
    PReport::reportMake(m_objname);
}
